import react from '@vitejs/plugin-react'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import svgr from 'vite-plugin-svgr'

// https://vitejs.dev/config/
export default defineConfig({
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          'primary-color': '#2772F7',
        },
        javascriptEnabled: true
      }
    }
  },
  plugins: [react(), svgr()],
  server: {
    proxy: {
      "/api": {
        // target: "http://47.98.200.75:8081/Hopeto",
        target: "http://127.0.0.1:8081/Hopeto",
        // target: "http://172.20.13.52:8081/Hopeto",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
      "/rewardsApi": {
        // target: "http://47.98.200.75:8081/api",
        // target: "http://127.0.0.1:8081/api",
        target: "http://172.20.13.52:8081/api",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/rewardsApi/, ""),
      },
    },
    port: 3000
  },
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    }
  },
})
